<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="embroot.css">
<TITLE>
Using the Java-ECLiPSe Interface
</TITLE>
</HEAD>
<BODY >
<A HREF="embroot036.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot049.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc71">Chapter&nbsp;8</A>&nbsp;&nbsp;Using the Java-ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> Interface</H1>
<A NAME="chapjava"></A>

The Java-ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> Interface is a general-purpose tool for
interfacing ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> with Java, Sun's popular object-oriented
platform-independent programming language. It could be used for
example to write a Java graphical front-end to an ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> optimisation
program or to interface ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> with a commercial application
written in Java. This document assumes a moderate level of programming
in Java (e.g. how to use classes, packages, interfaces etc. and some
knowledge of the <I>java.util</I>, <I>java.io</I> and <I>java.net</I>
libraries) and a basic knowledge of how to interact with ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>
(e.g. how to execute a goal, nondeterminism, what lists are
etc.). There are also some diagrams in UML notation, but these are not
crucial to the reader's understanding.<BR>
<BR>
Section <A HREF="embroot042.html#sec:ji-getting-started">8.1</A> is intended to get you started
quickly by running the example program <TT>QuickTest.java</TT>. Section
<A HREF="embroot043.html#sec:ji-closer-look">8.2</A> gives a brief overview of the functionality
of the Java-ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> interface by taking a closer look at how <TT>QuickTest.java</TT> works. In the other sections of the document you will
learn how to write Java programs which can:
<UL CLASS="itemize"><LI CLASS="li-itemize">Manipulate ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms and other data in Java (Section
<A HREF="embroot044.html#sec:ji-terms-in-java">8.3</A>).
<LI CLASS="li-itemize">Execute goals in ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> and use the results of this
computation in Java (Section <A HREF="embroot045.html#sec:ji-calling-goals">8.4</A>).
<LI CLASS="li-itemize">Transfer data between Java and ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> using queues<A NAME="@default162"></A>.
(Section <A HREF="embroot046.html#sec:ji-using-queue-streams">8.5</A>).
<LI CLASS="li-itemize">Initialise and terminate different kinds of connections between ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> and Java. (Section <A HREF="embroot048.html#sec:ji-managing-eclipse-connections">8.7</A>).
</UL>
Throughout this document, <TT>&lt;eclipse_dir&gt;</TT> stands for the root
location of your ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> installation. Detailed <TT>javadoc</TT>-generated HTML descriptions of the API provided by the <TT>com.parctechnologies.eclipse</TT> package can be found at:
<BLOCKQUOTE CLASS="quote">
<A HREF="../javadoc/JavaEclipseInterface/index.html"><TT>&lt;eclipse_dir&gt;</TT><TT>/doc/javadoc/JavaEclipseInterface/index.html</TT></A>
</BLOCKQUOTE>
You may wish to browse the API documentation after reading this
document to obtain more detailed descriptions of classes and
interfaces in the package.<BR>
<BR>
<UL>
<LI><A HREF="embroot042.html">Getting Started</A>
<UL>
<LI><A HREF="embroot042.html#toc32">Check your Java SDK version</A>
<LI><A HREF="embroot042.html#toc33">Make the <TT>com.parctechnologies.eclipse</TT> package available in your class path</A>
<LI><A HREF="embroot042.html#toc34">Compile and run <TT>QuickTest.java</TT></A>
</UL>
<LI><A HREF="embroot043.html">Functionality overview: A closer look at <TT>QuickTest.java</TT></A>
<LI><A HREF="embroot044.html">Java representation of ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> data</A>
<UL>
<LI><A HREF="embroot044.html#toc35">General correspondence between ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> and Java data types</A>
<LI><A HREF="embroot044.html#toc36">Atoms and compound terms</A>
<LI><A HREF="embroot044.html#toc37">Lists</A>
<LI><A HREF="embroot044.html#toc38">Floats and Doubles</A>
<LI><A HREF="embroot044.html#toc39">Integers</A>
<LI><A HREF="embroot044.html#toc40">Variables</A>
<LI><A HREF="embroot044.html#toc41">The <TT>equals()</TT> method</A>
</UL>
<LI><A HREF="embroot045.html">Executing an ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> goal from Java and processing the result</A>
<UL>
<LI><A HREF="embroot045.html#toc42">Passing the goal parameter to <TT>rpc</TT></A>
<LI><A HREF="embroot045.html#toc43">Note: <B>yield/2</B>, <B>remote_yield/1</B> and <TT>rpc</TT></A>
<LI><A HREF="embroot045.html#toc44">Retrieving the results of an <TT>rpc</TT> goal execution</A>
<LI><A HREF="embroot045.html#toc45">More details about <TT>rpc</TT> goal execution</A>
</UL>
<LI><A HREF="embroot046.html">Communicating between Java and ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> using queues</A>
<UL>
<LI><A HREF="embroot046.html#toc46">Opening, using and closing queues</A>
<LI><A HREF="embroot046.html#toc47">Opening a queue using ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> predicates</A>
<LI><A HREF="embroot046.html#toc48">Writing and reading ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms on queues</A>
<LI><A HREF="embroot046.html#toc49">Using the <I>QueueListener</I> interface</A>
<LI><A HREF="embroot046.html#toc50">Access to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>'s standard streams</A>
</UL>
<LI><A HREF="embroot047.html">Asynchronous Communicating between Java and ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP></A>
<UL>
<LI><A HREF="embroot047.html#toc51">Opening and closing asynchronous queues</A>
<LI><A HREF="embroot047.html#toc52">Opening an asychronous queue using ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> predicates</A>
<LI><A HREF="embroot047.html#toc53">Writing and reading ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms on queues</A>
</UL>
<LI><A HREF="embroot048.html">Managing connections to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP></A>
<UL>
<LI><A HREF="embroot048.html#toc54">A unified ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>-side interface to Java : the `peer' concept</A>
<LI><A HREF="embroot048.html#toc55">Creating and managing ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> engines from Java</A>
<LI><A HREF="embroot048.html#toc56">Connecting to an existing ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> engine using <I>RemoteEclipse</I></A>
<LI><A HREF="embroot048.html#toc57">Comparison of different Java-ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> connection techniques</A>
</UL>
</UL>
<BR>
<BR>

<BR>
<BR>
<HR WIDTH="50%" SIZE=1><DL CLASS="list"><DT CLASS="dt-list"><A NAME="note8" HREF="embroot046.html#text8"><FONT SIZE=5>1</FONT></A><DD CLASS="dd-list">Note that this invocation occurs only if the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> side of the queue is empty. If you have written data to the queue on the Java side, but not flushed it, the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> side may still be empty, in which case the <TT>dataRequest</TT> method of the listener will be invoked.
</DL>
<HR>
<A HREF="embroot036.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot049.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
